package svc

import (
	"doctor-medicine-system/api/internal/config"
	"doctor-medicine-system/api/internal/middleware"
	"doctor-medicine-system/goods/goodsclient"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
)

type ServiceContext struct {
	Config              config.Config
	GoodsRpc            goodsclient.Goods
	UserAgentMiddleware rest.Middleware
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:              c,
		GoodsRpc:            goodsclient.NewGoods(zrpc.MustNewClient(c.GoodsRpc)),
		UserAgentMiddleware: middleware.NewUserAgentMiddleware().Handle,
	}
}
